import 'package:easy_chat_app/commons/utils/RouteUtils.dart';
import 'package:flutter/material.dart';

class ConfirmDialog {
  static Future<bool> show(BuildContext context,
      {required Text content, Text? cancelText, Text? confirmText}) async {
    cancelText ??= const Text("取消", style: TextStyle(color: Colors.black));
    confirmText ??= const Text("确定", style: TextStyle(color: Colors.black));

    bool? result = await showDialog(
        context: context,
        builder: (context) {
          return AlertDialog(
            content: content,
            shape: const RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(5))),
            actions: [
              TextButton(
                  onPressed: () {
                    RouteUtils.pop(false);
                  },
                  child: cancelText!),
              TextButton(
                  onPressed: () {
                    RouteUtils.pop(true);
                  },
                  child: confirmText!)
            ],
          );
        });
    return result!;
  }
}
